package com.group.hugedatabehind.mapper;

import com.group.hugedatabehind.pojo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;


import java.util.List;

@Mapper
public interface ApplicationMapper {

    @Select("select * from tb_rs_total_msg_cnt")
    @Results({
            @Result(column = "tb_rs_total_msg_cnt.msg_day", property = "msgDay"),
            @Result(column = "tb_rs_total_msg_cnt.total_msg_cnt", property = "totalMsgCnt")
    })
    One getOne();


    @Select("select * from tb_rs_hour_msg_cnt order by cast(msg_hour as int )")
    @Results({
            @Result(column = "tb_rs_hour_msg_cnt.msg_hour", property = "msgHour"),
            @Result(column = "tb_rs_hour_msg_cnt.total_msg_cnt", property = "totalMsgCnt"),
            @Result(column = "tb_rs_hour_msg_cnt.sender_user_cnt", property = "senderUserCnt"),
            @Result(column = "tb_rs_hour_msg_cnt.receiver_user_cnt", property = "receiverUserCnt")
    })
    List<Two> getTwo();


    @Select("select * from tb_rs_loc_cnt")
    @Results({
            @Result(column = "tb_rs_loc_cnt.msg_day", property = "msgDay"),
            @Result(column = "tb_rs_loc_cnt.sender_lng", property = "senderLng"),
            @Result(column = "tb_rs_loc_cnt.sender_lat", property = "senderLat"),
            @Result(column = "tb_rs_loc_cnt.total_msg_cnt", property = "totalMsgCnt")
    })
    List<Three> getThree();

    @Select("select * from tb_rs_user_cnt")
    @Results({
            @Result(column = "tb_rs_user_cnt.msg_day", property = "msgDay"),
            @Result(column = "tb_rs_user_cnt.sender_user_cnt", property = "senderUserCnt"),
            @Result(column = "tb_rs_user_cnt.receiver_user_cnt", property = "receiverUserCnt")
    })
    Four getFour();

    @Select("select * from tb_rs_s_user_top10")
    @Results({
            @Result(column = "tb_rs_s_user_top10.username", property = "userName"),
            @Result(column = "tb_rs_s_user_top10.sender_msg_cnt", property = "senderMsgCnt")
    })
    List<Five> getFive();

    @Select("select * from tb_rs_r_user_top10")
    @Results({
            @Result(column = "tb_rs_r_user_top10.username", property = "userName"),
            @Result(column = "tb_rs_r_user_top10.receiver_msg_cnt", property = "receiverMsgCnt")
    })
    List<Six> getSix();

    @Select("select * from tb_rs_sender_phone")
    @Results({
            @Result(column = "tb_rs_sender_phone.sender_phonetype", property = "senderPhonetype"),
            @Result(column = "tb_rs_sender_phone.cnt", property = "cnt")
    })
    List<Seven> getSeven();

    @Select("select * from tb_rs_sender_os")
    @Results({
            @Result(column = "tb_rs_sender_os.sender_os", property = "senderOs"),
            @Result(column = "tb_rs_sender_os.cnt", property = "cnt")
    })
    List<Eight> getEight();

    @Select("SELECT * FROM tb_same_name_statistics")
    @Results({
            @Result(column = "tb_same_name_statistics.sender_name", property = "sendername"),
            @Result(column = "tb_same_name_statistics.namecount", property = "cnt")
    })
    List<Nine> getNine();

    //将查询结果的列（数据库表中的字段）映射到 Java 对象的属性上。
    @Select("select * from tb_rs_network_distribution")
    @Results({
            @Result(column = "tb_rs_network_distribution.sender_network", property = "senderNetwork"),
            @Result(column = "tb_rs_network_distribution.sender_network_cnt", property = "senderNetworkCnt")
    })
    List<Ten> getTen();

    @Select("select * from tb_rs_receiver_network_distribution")
    @Results({
            @Result(column = "tb_rs_receiver_network_distribution.receiver_network", property = "receiverNetwork"),
            @Result(column = "tb_rs_receiver_network_distribution.receiver_network_cnt", property = "receiverNetworkCnt")
    })
    List<Eleven> getEleven();

    @Select("select * from tb_rs_phone_gender_distribution")
    @Results({
            @Result(column = "tb_rs_phone_gender_distribution.sender_phonetype", property = "senderPhonetype"),
            @Result(column = "tb_rs_phone_gender_distribution.msg_cnt", property = "msgCnt"),
            @Result(column = "tb_rs_phone_gender_distribution.sender_sex", property = "senderGender")
    })
    List<Twelve> getTwelve();

}
